﻿using System;
using Steamworks;

namespace Terraria.Net
{
	// Token: 0x02000152 RID: 338
	public class SteamAddress : RemoteAddress
	{
		// Token: 0x06000E97 RID: 3735 RVA: 0x0000E03D File Offset: 0x0000C23D
		public SteamAddress(CSteamID steamId)
		{
			this.Type = AddressType.Steam;
			this.SteamId = steamId;
		}

		// Token: 0x06000E98 RID: 3736 RVA: 0x003FFF78 File Offset: 0x003FE178
		public override string ToString()
		{
			string str = (this.SteamId.m_SteamID % 2UL).ToString();
			string str2 = ((this.SteamId.m_SteamID - (76561197960265728UL + this.SteamId.m_SteamID % 2UL)) / 2UL).ToString();
			return "STEAM_0:" + str + ":" + str2;
		}

		// Token: 0x06000E99 RID: 3737 RVA: 0x0000E053 File Offset: 0x0000C253
		public override string GetIdentifier()
		{
			return this.ToString();
		}

		// Token: 0x06000E9A RID: 3738 RVA: 0x003FFFE0 File Offset: 0x003FE1E0
		public override bool IsLocalHost()
		{
			if (Program.LaunchParameters.ContainsKey("-localsteamid"))
			{
				string text = Program.LaunchParameters["-localsteamid"];
				ulong steamID = this.SteamId.m_SteamID;
				return text.Equals(steamID.ToString());
			}
			return false;
		}

		// Token: 0x06000E9B RID: 3739 RVA: 0x0000E05B File Offset: 0x0000C25B
		public override string GetFriendlyName()
		{
			if (this._friendlyName == null)
			{
				this._friendlyName = SteamFriends.GetFriendPersonaName(this.SteamId);
			}
			return this._friendlyName;
		}

		// Token: 0x04001252 RID: 4690
		public readonly CSteamID SteamId;

		// Token: 0x04001253 RID: 4691
		private string _friendlyName;
	}
}
